//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Chart
{
    public class PictureOptions : IOfficeXmlSerializable
    {
        private bool? _applyToFront;
        private bool? _applyToSides;
        private bool? _applyToEnd;
        private PictureFormat? _pictureFormat;
        private double? _pictureStackUnit;

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("pictureOptions"))
            {
                _applyToFront = c.ReadOptionalElementBooleanAttribute("applyToFront");
                _applyToSides = c.ReadOptionalElementBooleanAttribute("applyToSides");
                _applyToEnd = c.ReadOptionalElementBooleanAttribute("applyToEnd");
                _pictureFormat = c.ReadOptionalElementEnumAttribute<PictureFormat>("pictureFormat");
                _pictureStackUnit = c.ReadOptionalElementDoubleAttribute("pictureStackUnit");
            }
        }



        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (var c = context.Write("pictureOptions"))
            {
                c.WriteOptionalElementBooleanAttribute("applyToFront", _applyToFront);
                c.WriteOptionalElementBooleanAttribute("applyToSides", _applyToSides);
                c.WriteOptionalElementBooleanAttribute("applyToEnd", _applyToEnd);
                c.WriteOptionalElementEnumAttribute("pictureFormat", _pictureFormat);
                c.WriteOptionalElementDoubleAttribute("pictureStackUnit", _pictureStackUnit);
            }
        }

        #endregion
    }
}